/* Subject Desgin Pattern - taken from the presentation
 *
 */

#pragma once
#include "Subject.h"

using namespace std;

Subject::Subject(){
	//
}

Subject::~Subject(){
	//
}

void Subject::Attach(Observer* observer){
	m_observers.push_back(observer);
}

void Subject::Detach(Observer* observer){
	unsigned int i=0; 
	for (i = 0; i < m_observers.size(); i++) 
		if (m_observers[i] == observer) break; 
	m_observers.erase(m_observers.begin() + i); 
}

void Subject::Notify(const string& message) { 
	for (unsigned int i = 0; i < m_observers.size(); i++) 
		(m_observers[i])->Update(this, message); 
}
